define([ "PDUtilDir/grid", "PDUtilDir/searchBlock", "PDUtilDir/slidebar" ],
		function(Grid, SearchBlock, Slidebar) {
			function init(cache, addObj, searchObj) {
				SearchBlock.init('searchBlockId');
				// 初始化
				return Grid({
					id : "RelationGirdDivId",
					pageSize : 10,
					index : true,
					multi : false,
					pagination : true,
					cache : false,
					layout : [ {
						name : "机构名称",
						field : "deptName",
						sort : true
					}, {
						name : "代码",
						field : "deptCode",
						sort : true
					}, {
						name : "电话",
						field : "phone",
						width : "10%"
					}, {
						name : "组织类型",
						field : "serviceType",
						format:function(e){
							if(!cache.serviceTypes)
								return;
							for(var i=0;i<cache.serviceTypes.length;i++){
								if(cache.serviceTypes[i].dictCode==e.row.serviceType){
									return cache.serviceTypes[i].dictName;
								}
							}
						}
					}, {
						name : "状态",
						field : "deleted",
						format:function(e){
							if(e.row.deleted==0){
								return "冻结";
							}else{
								return "正常";
							}
						}
					} ],
					toolbar : [ {
//						name : "添加",
						name : "管理",
						icon : "fa fa-plus-circle",
						callback : function(event) {
							addObj.run();
						}
					}, /*{
						name : "删除",
						icon : "fa fa-trash-o",
						callback : function(event) {
							delObj.run();
						}
					},*/ {
						name : "查询",
						icon : "fa fa-search",
						callback : function(event) {
						    searchObj.run();
						}
					} ],
					data : {
						type : "URL",
						value : getServer() + "/flea/hclv/serviceOrg/queryAllServiceOrgPage.htmls",
					}
				});
			}
			return {
				init : init
			}
		});